{template header}


  <header>
    <a href="/index.php?m=user&c=index&a=setting" class="headerL iconfont">&#xe66a;</a>
    <h1>修改登录密码</h1>
  </header>
  <!-- E header -->
  
  <dl class="bgWhite sendTo">
    <dt>将发送验证码短信到</dt>
    <dd><?php echo hidemobi($this->userinfo['mobile_phone']);?></dd>
  </dl>
 


<form class="registerform" action="{U('User/User/repass')}" method="post"  > 
  <span class="registerBox">
    <ul class="change_num_box"> 


      <li class="flex">
        <label class="label">图形验证码</label>
        <div class="flex-1 input_box"><input type="text" name="imgcode" id="imgcode" placeholder="请输入图形验证码"  placeholder="请输入图形验证码"  datatype="*"  nullmsg='请输入图形验证码' class="alignR"></div><span class="tx_yzm" onclick="resetImgCode();"><img id="img_code" src="{U('User/Public/verify')}" width="85" height="37" /></span></li>
      <li class="flex">
        <label class="label">验证码</label>
        <div class="flex-1 input_box"><input type="text" name="mobi_code" id="mobi_code"  placeholder="请输入手机验证码"  datatype="*"  nullmsg='请输入手机验证码' class="alignR"></div>
        <a href="javascript:;" class="get_code send_code">获取验证码</a>
      </li>
      <li class="flex">
        <label class="label">新密码</label>
        <div class="flex-1 input_box"><input type="password" placeholder="请设置您的新密码"  datatype="password" errormsg="新密码范围在6~15位之间！" name="password" id="password" nullmsg='请填写密码，密码范围在6~15位之间' class="alignR"></div>
      </li>
      <li class="flex">
        <label class="label">确认新密码</label>
        <div class="flex-1 input_box"><input type="password" placeholder="再次输入您的新密码"   name="firmpawd" datatype="*" recheck="password" nullmsg="请再输入一次密码！" errormsg="您两次输入的账号密码不一致！" class="alignR"></div>
      </li>
     
    </ul>
    <a href="javascript:;" class="service_affirm_btn" onclick="submitForm();">注册</a>
    <p class="alignC without_account">已有账户，去<a href="" class="red inline_block">登录</a></p>
  </span>
</form>


<script type="text/javascript">
  function resetImgCode(){
    $("#img_code").attr("src",'/index.php?m=user&c=public&a=verify&t='+Math.round(new Date().getTime()/1000));
  }
$(function(){
    $(".send_code").click(function(){
      console.log(1);
        var text=$(this).text();
        var type=$(this).attr("type");
        if(text!="获取验证码"){
            return false;
        }
        console.log(2);

    var imgcode = $("#imgcode").val();
    if(imgcode==""){
      tips("请填写图形验证码");
      $("#imgcode").blur();
      return;
    }
    $.ajax({
      url: "{U('User/Public/send_code')}&token={$_SESSION[send_code_time]}&type=repass&code="+imgcode,
      timeout: 5000,cache: false,type: "get",async : false,dataType: "json",
      success: function (d){
        if(d.status==1){
           downtime(120);
        }
        tips(d.info);
      }
    });
    })
})
/**
* 验证码倒计时
* time 倒计时时间：秒
**/
function downtime(time){
  //循环调用
  if(time == '0'){
    $('.send_code').text('发送验证码');
  }else{
    time --;
    $('.send_code').text('重新发送('+time+')');
    setTimeout(function() {
    downtime(time);
    },1000);
  }
}
</script>
<script type="text/javascript">
  function submitForm(){
    $(".registerform").submit();
    layer.open({type: 2});
  }
$(function(){
  $(".registerform").Validform({
      tiptype:function(msg,o,cssctl){
        if(o.type==3){
          layer.closeAll();
          //$(".errmsg").text(msg).show();
          tips(msg);
          return false;
        }
        if(o.type==1){
          o.obj.addClass("Validform_success")
        }
      },
      datatype:{
        "password": function( gets , obj , curform , regxp ){
           var reg1=/^[^\s]{6,15}$/;
           if(!reg1.test(gets)){
            return "新密码范围在6~15位之间";
           }
        },
        "pinpass": function( gets , obj , curform , regxp ){
           var reg1=/^[0-9]{6,6}$/;
           if(!reg1.test(gets)){
            return "支付密码必须为六位数字";
           }else{
            return true;   
           }
        },        
        "need1": function( gets , obj , curform , regxp ){
          var need=1,
            numselected=curform.find("input[name='"+obj.attr("name")+"']:checked").length;
          return  numselected >= need ? true : "请阅读注册协议";
        }
      },
      ajaxPost: true,
      callback: function(ret) {
        layer.closeAll();
        if (ret.status == 0) {
          //$(".errmsg").text(ret.info).show();
          tips(ret.info);
        } else {
          layer.open({
            content: ret.info
            ,skin: 'msg'
            ,time: 2
            ,end:function(){
                location.href = "/index.php?m=user&c=index&a=setting";
            }
          });
        }
      }
  });
});
</script>
</body>
</html>